﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace UniRx
{
	// Token: 0x0200044D RID: 1101
	public static class UnityEqualityComparer
	{
		// Token: 0x0600177F RID: 6015 RVA: 0x00063EDC File Offset: 0x000622DC
		public static IEqualityComparer<T> GetDefault<T>()
		{
			RuntimeTypeHandle typeHandle = UnityEqualityComparer.RuntimeTypeHandlerCache<T>.TypeHandle;
			if (typeHandle.Equals(UnityEqualityComparer.vector2Type))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Vector2;
			}
			if (typeHandle.Equals(UnityEqualityComparer.vector3Type))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Vector3;
			}
			if (typeHandle.Equals(UnityEqualityComparer.vector4Type))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Vector4;
			}
			if (typeHandle.Equals(UnityEqualityComparer.colorType))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Color;
			}
			if (typeHandle.Equals(UnityEqualityComparer.rectType))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Rect;
			}
			if (typeHandle.Equals(UnityEqualityComparer.boundsType))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Bounds;
			}
			if (typeHandle.Equals(UnityEqualityComparer.quaternionType))
			{
				return (IEqualityComparer<T>)UnityEqualityComparer.Quaternion;
			}
			return EqualityComparer<T>.Default;
		}

		// Token: 0x04000CE2 RID: 3298
		public static readonly IEqualityComparer<Vector2> Vector2 = new UnityEqualityComparer.Vector2EqualityComparer();

		// Token: 0x04000CE3 RID: 3299
		public static readonly IEqualityComparer<Vector3> Vector3 = new UnityEqualityComparer.Vector3EqualityComparer();

		// Token: 0x04000CE4 RID: 3300
		public static readonly IEqualityComparer<Vector4> Vector4 = new UnityEqualityComparer.Vector4EqualityComparer();

		// Token: 0x04000CE5 RID: 3301
		public static readonly IEqualityComparer<Color> Color = new UnityEqualityComparer.ColorEqualityComparer();

		// Token: 0x04000CE6 RID: 3302
		public static readonly IEqualityComparer<Rect> Rect = new UnityEqualityComparer.RectEqualityComparer();

		// Token: 0x04000CE7 RID: 3303
		public static readonly IEqualityComparer<Bounds> Bounds = new UnityEqualityComparer.BoundsEqualityComparer();

		// Token: 0x04000CE8 RID: 3304
		public static readonly IEqualityComparer<Quaternion> Quaternion = new UnityEqualityComparer.QuaternionEqualityComparer();

		// Token: 0x04000CE9 RID: 3305
		private static readonly RuntimeTypeHandle vector2Type = typeof(Vector2).TypeHandle;

		// Token: 0x04000CEA RID: 3306
		private static readonly RuntimeTypeHandle vector3Type = typeof(Vector3).TypeHandle;

		// Token: 0x04000CEB RID: 3307
		private static readonly RuntimeTypeHandle vector4Type = typeof(Vector4).TypeHandle;

		// Token: 0x04000CEC RID: 3308
		private static readonly RuntimeTypeHandle colorType = typeof(Color).TypeHandle;

		// Token: 0x04000CED RID: 3309
		private static readonly RuntimeTypeHandle rectType = typeof(Rect).TypeHandle;

		// Token: 0x04000CEE RID: 3310
		private static readonly RuntimeTypeHandle boundsType = typeof(Bounds).TypeHandle;

		// Token: 0x04000CEF RID: 3311
		private static readonly RuntimeTypeHandle quaternionType = typeof(Quaternion).TypeHandle;

		// Token: 0x0200044E RID: 1102
		private static class RuntimeTypeHandlerCache<T>
		{
			// Token: 0x04000CF0 RID: 3312
			public static readonly RuntimeTypeHandle TypeHandle = typeof(T).TypeHandle;
		}

		// Token: 0x0200044F RID: 1103
		private class Vector2EqualityComparer : IEqualityComparer<Vector2>
		{
			// Token: 0x06001783 RID: 6019 RVA: 0x000640B5 File Offset: 0x000624B5
			public bool Equals(Vector2 self, Vector2 vector)
			{
				return self.x.Equals(vector.x) && self.y.Equals(vector.y);
			}

			// Token: 0x06001784 RID: 6020 RVA: 0x000640E5 File Offset: 0x000624E5
			public int GetHashCode(Vector2 obj)
			{
				return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2;
			}
		}

		// Token: 0x02000450 RID: 1104
		private class Vector3EqualityComparer : IEqualityComparer<Vector3>
		{
			// Token: 0x06001786 RID: 6022 RVA: 0x00064118 File Offset: 0x00062518
			public bool Equals(Vector3 self, Vector3 vector)
			{
				return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z);
			}

			// Token: 0x06001787 RID: 6023 RVA: 0x0006416B File Offset: 0x0006256B
			public int GetHashCode(Vector3 obj)
			{
				return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2;
			}
		}

		// Token: 0x02000451 RID: 1105
		private class Vector4EqualityComparer : IEqualityComparer<Vector4>
		{
			// Token: 0x06001789 RID: 6025 RVA: 0x000641B4 File Offset: 0x000625B4
			public bool Equals(Vector4 self, Vector4 vector)
			{
				return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z) && self.w.Equals(vector.w);
			}

			// Token: 0x0600178A RID: 6026 RVA: 0x00064220 File Offset: 0x00062620
			public int GetHashCode(Vector4 obj)
			{
				return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2 ^ obj.w.GetHashCode() >> 1;
			}
		}

		// Token: 0x02000452 RID: 1106
		private class ColorEqualityComparer : IEqualityComparer<Color>
		{
			// Token: 0x0600178C RID: 6028 RVA: 0x00064288 File Offset: 0x00062688
			public bool Equals(Color self, Color other)
			{
				return self.r.Equals(other.r) && self.g.Equals(other.g) && self.b.Equals(other.b) && self.a.Equals(other.a);
			}

			// Token: 0x0600178D RID: 6029 RVA: 0x000642F4 File Offset: 0x000626F4
			public int GetHashCode(Color obj)
			{
				return obj.r.GetHashCode() ^ obj.g.GetHashCode() << 2 ^ obj.b.GetHashCode() >> 2 ^ obj.a.GetHashCode() >> 1;
			}
		}

		// Token: 0x02000453 RID: 1107
		private class RectEqualityComparer : IEqualityComparer<Rect>
		{
			// Token: 0x0600178F RID: 6031 RVA: 0x0006435C File Offset: 0x0006275C
			public bool Equals(Rect self, Rect other)
			{
				return self.x.Equals(other.x) && self.width.Equals(other.width) && self.y.Equals(other.y) && self.height.Equals(other.height);
			}

			// Token: 0x06001790 RID: 6032 RVA: 0x000643D4 File Offset: 0x000627D4
			public int GetHashCode(Rect obj)
			{
				return obj.x.GetHashCode() ^ obj.width.GetHashCode() << 2 ^ obj.y.GetHashCode() >> 2 ^ obj.height.GetHashCode() >> 1;
			}
		}

		// Token: 0x02000454 RID: 1108
		private class BoundsEqualityComparer : IEqualityComparer<Bounds>
		{
			// Token: 0x06001792 RID: 6034 RVA: 0x00064448 File Offset: 0x00062848
			public bool Equals(Bounds self, Bounds vector)
			{
				return self.center.Equals(vector.center) && self.extents.Equals(vector.extents);
			}

			// Token: 0x06001793 RID: 6035 RVA: 0x000644A0 File Offset: 0x000628A0
			public int GetHashCode(Bounds obj)
			{
				return obj.center.GetHashCode() ^ obj.extents.GetHashCode() << 2;
			}
		}

		// Token: 0x02000455 RID: 1109
		private class QuaternionEqualityComparer : IEqualityComparer<Quaternion>
		{
			// Token: 0x06001795 RID: 6037 RVA: 0x000644E4 File Offset: 0x000628E4
			public bool Equals(Quaternion self, Quaternion vector)
			{
				return self.x.Equals(vector.x) && self.y.Equals(vector.y) && self.z.Equals(vector.z) && self.w.Equals(vector.w);
			}

			// Token: 0x06001796 RID: 6038 RVA: 0x00064550 File Offset: 0x00062950
			public int GetHashCode(Quaternion obj)
			{
				return obj.x.GetHashCode() ^ obj.y.GetHashCode() << 2 ^ obj.z.GetHashCode() >> 2 ^ obj.w.GetHashCode() >> 1;
			}
		}
	}
}
